package com.dhl.visitor;

import com.dhl.visitor.evaluating.Person;

import java.util.ArrayList;
import java.util.List;

/**
 * @title: ObjectStructure
 * @Author danghailiang
 * @Date: 2022/8/20 13:09
 * @Version 1.0
 */
public class ObjectStructure {
    // 维护集合
    private List<Person> persons = new ArrayList<>();
    public void attach(Person person){
        // 添加评测人
        persons.add(person);
    }
    public void deyach(Person person){
        // 添加评测人
        persons.remove(person);
    }
    public void dispany(Action action){
        for (Person person: persons){
            person.accept(action);
        }
    }
}
